package com.chalk.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.chalk.model.SysUser;
import com.chalk.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 系统用户表(SysUser)表数据库访问层
 *
 * @author maxiaoqiang
 * @since 2019-03-22 17:38:25
 */
@Mapper
public interface SysUserDao extends BaseMapper<SysUser> {

    /*自定义接口*/

    /**
     * 根据主键批量(逻辑)删除
     *
     * @param ids
     * @return
     */
    int deleteBatchByPrimaryKey(String[] ids);

    @Select("select * from t_sys_user where userName=#{userName}")
    List<SysUser> getUserByUserName(@Param("userName")String userName);

    List<UserVo> getUserByPage(Pagination pagination , SysUser sysUser);

    /**
     * 根据门店名称查询用户列表
     *
     *@param pagination
     * @param sysUser
     * @return
     */
    List<UserVo> selectListByShopName(Pagination pagination, SysUser sysUser);

    /**
     * 销售人员查询所属门店
     *
     * @param userId
     * @return
     */
    List<String> searchShopNameByUserId(@Param("userId") String userId);
}